package com.t8;

import org.omg.CORBA.PUBLIC_MEMBER;

import java.util.Random;

/**
 * Created by xuyiwei on 2018/7/19.
 */
class Shape {
    public void draw() {
    };

    public void erase() {
    };

    public void all(){

    }
}

class Circle extends Shape {
    @Override
    public void draw() {
        System.out.println(" Circle draw()");
    }

    @Override
    public void erase() {
        System.out.println(" Circle erase()");
    }
}


class Square extends Shape {
    @Override
    public void draw() {
        System.out.println(" Square draw()");
    }

    @Override
    public void erase() {
        System.out.println(" Square erase()");
    }
}

class Triangle extends Shape {
    @Override
    public void draw() {
        System.out.println(" Triangle draw()");
    }

    @Override
    public void erase() {
        System.out.println(" Triangle erase()");
    }
}


public class RandomShapeGenerator {
    private Random random = new Random(47);

    public Shape next() {
        switch (random.nextInt(3)) {
            case 1:
                return new Circle();

            case 2:
                return new Square();

            case 3:
                return new Triangle();

            default:
                return new Triangle();
        }
    }
}


